package designMode.strategyPattern;

//上下文类-持有策略接口的引用，调用具体策略的方法。--策略类加载器
public class Context {
    private Strategy strategy;

    public void setStrategy(Strategy strategy) {
        this.strategy = strategy;
    }

    public void executeStrategy() {
        if (strategy != null) {
            strategy.execute();
        } else {
            System.out.println("No strategy set");
        }
    }
}
